#ifndef __CINETIC__GAME_OBJECT_H__
#define __CINETIC__GAME_OBJECT_H__
#pragma once

#include "Component.h"
#include "Delegate.h"
#include "Object.h"

#include <memory>
#include <vector>

namespace Cinetic
{
	//Base class for an aggregation of components that represent an entity in the game
	class GameObject : public Object, public std::enable_shared_from_this<GameObject>
	{
        typedef std::vector<std::shared_ptr<Component>> ComponentList;
        typedef ComponentList::iterator ComponentIterator;

    public:
        typedef Delegate<void ( std::weak_ptr<GameObject>, std::weak_ptr<Component>)> ComponentChangedDelegate;
        typedef ComponentChangedDelegate::Event ComponentChangedEvent;
        ComponentChangedEvent   ComponentAdded;
        ComponentChangedEvent   ComponentRemoved;

	public:
		void	            add_component( std::shared_ptr<Component> comp );
        void                remove_component( std::shared_ptr<Component> comp );
        ComponentIterator   component_begin();
        ComponentIterator   component_end();

	private:
		ComponentList       m_components;
	};

}

#endif